// 频道相关请求
import request from '@/utils/request.js'

/**
 * 获取所有频道列表
 * @returns promise
 */
export const getAllChannel = () => {
  return request({
    method: 'GET',
    url: '/v1_0/channels'
  })
}

/**
 * 添加用户频道
 * @param {*} obj {id:频道id,seq:序号}
 * @returns
 */
export const addUserChannel = obj => {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/channels',
    data: {
      channels: [obj]
    }
  })
}

/**
 * 删除频道
 * @param {*} target 删除频道的id
 * @returns promise
 */
export const delUserChannel = target => {
  return request({
    method: 'DELETE',
    url: `/v1_0/user/channels/${target}`
  })
}
